{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "import json\n",
    "import os\n",
    "from pprint import pprint\n",
    "\n",
    "import lasio.examples"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'0.25.0'"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "lasio.__version__"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "las = lasio.examples.open(\"6038187_v1.2_short.las\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "To export to JSON you need to use a special encoder:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [],
   "source": [
    "t = json.dumps(l, cls=lasio.JSONEncoder)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{\"metadata\": {\"Version\": {\"VERS\": 2.0, \"WRAP\": \"NO\"}, \"Well\": {\"STRT\": 0.05, \"STOP\": 136.6, \"STEP\": 0.05, \"NULL\": -99999, \"COMP\": \"\", \"WELL\": \"Scorpio E1\", \"FLD\": \"\", \"LOC\": \"Mt Eba\", \"SRVC\": \"\", \"CTRY\": \"\", \"STAT\": \"SA\", \"CNTY\": \"\", \"DATE\": \"15/03/2015\", \"UWI\": \"6038-187\"}, \"Curves\": {\"DEPT\": \"\", \"CALI\": \"\", \"DFAR\": \"\", \"DNEAR\": \"\", \"GAMN\": \"\", \"NEUT\": \"\", \"PR\": \"\", \"SP\": \"\", \"COND\": \"\"}, \"Parameter\": {\"BS\": \"216 mm\", \"JOBN\": \"\", \"WPMT\": \"\", \"AGL\": \"\", \"PURP\": \"Cased hole stratigraphy\", \"X\": 560160, \"CSGL\": \"0 m - 135 m\", \"UNIT\": \"\", \"Y\": 6686430, \"TDL\": \"135.2 m\", \"PROD\": \"\", \"MUD\": \"Water\", \"CSGS\": \"100 mm\", \"ENG\": \"\", \"STEP\": \"5 cm\", \"FLUIDLEVEL\": \"54 m\", \"CSGT\": \"PVC\", \"WIT\": \"\", \"EREF\": \"\", \"PROJ\": \"\", \"ZONE\": \"53J\", \"DREF\": \"GL\", \"TDD\": \"136 m\"}, \"Other\": \"\"}, \"data\": {\"DEPT\": [12.0, 12.05, 12.1, 12.15, 12.2, 12.25, 12.3, 12.35, 12.4, 12.45, 12.5, 12.55, 12.6, 12.65, 12.7, 12.75, 12.8, 12.85, 12.9, 12.95, 13.0, 13.05, 13.1, 13.15, 13.2, 13.25, 13.3, 13.35, 13.4, 13.45, 13.5, 13.55, 13.6, 13.65, 13.7, 13.75, 13.8, 13.85, 13.9, 13.95, 14.0, 14.05, 14.1, 14.15, 14.2, 14.25, 14.3, 14.35, 14.4, 14.45, 14.5, 14.55, 14.6, 14.65, 14.7, 14.75, 14.8, 14.85, 14.9, 14.95, 15.0, 15.05, 15.1, 15.15, 15.2, 15.25, 15.3, 15.35, 15.4, 15.45, 15.5, 15.55, 15.6, 15.65, 15.7, 15.75, 15.8, 15.85, 15.9, 15.95, 16.0, 16.05, 16.1, 16.15, 16.2, 16.25, 16.3, 16.35, 16.4, 16.45, 16.5, 16.55, 16.6, 16.65, 16.7, 16.75, 16.8, 16.85, 16.9, 16.95, 17.0, 17.05, 17.1, 17.15, 17.2, 17.25, 17.3, 17.35, 17.4, 17.45, 17.5, 17.55, 17.6, 17.65, 17.7, 17.75, 17.8, 17.85, 17.9, 17.95, 18.0], \"CALI\": [101.78, 101.738, 101.738, 101.858, 101.798, 101.756, 101.804, 101.798, 101.852, 101.87, 101.906, 101.816, 101.714, 101.768, 101.816, 101.828, 101.696, 101.69, 101.744, 101.66, 101.6, 101.708, 101.78, 101.792, 101.618, 101.576, 101.606, 101.504, 101.516, 101.54, 101.546, 101.45, 101.612, 101.744, 101.762, 101.762, 101.792, 101.816, 101.696, 101.696, 101.666, 101.69, 101.858, 101.81, 101.792, 101.828, 101.81, 101.54, 101.54, 101.516, 101.516, 101.498, 101.504, 101.54, 101.348, 101.366, 101.42, 101.408, 101.36, 101.318, 101.324, 101.348, 101.307, 101.283, 101.378, 101.295, 101.283, 101.396, 101.36, 101.372, 101.348, 101.408, 101.402, 101.498, 101.432, 101.516, 101.594, 101.528, 101.534, 101.528, 101.528, 101.528, 101.66, 101.732, 101.696, 101.714, 101.696, 101.66, 101.666, 101.78, 101.72, 101.624, 101.696, 101.696, 101.684, 101.708, 101.69, 101.69, 101.762, 101.84, 101.636, 101.612, 101.576, 101.618, 101.492, 102.715, 101.157, 101.432, 101.636, 101.594, 101.474, 101.546, 101.366, 101.318, 101.384, 101.384, 101.295, 101.223, 101.241, 101.235, 101.259], \"DFAR\": [0.883, 0.883, 0.873, 0.878, 0.878, 0.869, 0.882, 0.88, 0.877, 0.878, 0.87, 0.883, 0.864001, 0.863, 0.869, 0.875, 0.865, 0.867, 0.851, 0.851, 0.837, 0.839, 0.838, 0.837, 0.847, 0.846, 0.845, 0.822001, 0.793, 0.726, 0.725, 0.725, 0.762999, 0.755, 0.793, 0.836, 0.959, 1.045, 1.133, 1.231, 1.34, 1.386, 1.358, 1.357, 1.354, 1.378, 1.372, 1.423, 1.425, 1.417, 1.416, 1.412, 1.448, 1.43, 1.413, 1.436, 1.382, 1.391, 1.409, 1.384, 1.382, 1.39, 1.398, 1.423, 1.427, 1.418, 1.409, 1.398, 1.438, 1.437, 1.429, 1.42, 1.437, 1.448, 1.466, 1.437, 1.437, 1.431, 1.452, 1.44, 1.463, 1.478, 1.492, 1.487, 1.471, 1.497, 1.487, 1.478, 1.503, 1.487, 1.488, 1.491, 1.486, 1.501, 1.495, 1.493, 1.483, 1.49, 1.474, 1.505, 1.482, 1.489, 1.476, 1.455, 1.482, 1.487, 1.477, 1.455, 1.444, 1.455, 1.46, 1.418, 1.429, 1.374, 1.401, 1.391, 1.374, 1.382, 1.417, 1.378, 1.381], \"DNEAR\": [0.814, 0.843, 0.808001, 0.813, 0.787, 0.765, 0.811, 0.823, 0.823, 0.826, 0.85, 0.862, 0.815002, 0.802, 0.808, 0.797, 0.907, 0.808004, 0.826, 0.796, 0.815, 0.813, 0.827999, 0.809, 0.761, 0.797, 0.767, 0.838997, 0.876, 0.896, 0.897, 0.894, 0.899, 0.835, 0.809, 0.783, 0.683, 0.657001, 0.8, 1.111, 1.434, 1.463, 1.462, 1.471, 1.558, 1.666, 1.742, 1.778, 1.667, 1.608, 1.542, 1.557, 1.672, 1.59, 1.578, 1.581, 1.514, 1.543, 1.506, 1.516, 1.439, 1.51, 1.5, 1.529, 1.538, 1.54, 1.468, 1.479, 1.471, 1.55, 1.543, 1.537, 1.553, 1.511, 1.55, 1.485, 1.481, 1.509, 1.524, 1.539, 1.568, 1.559, 1.556, 1.568, 1.606, 1.58, 1.6, 1.587, 1.585, 1.557, 1.568, 1.576, 1.572, 1.598, 1.547, 1.582, 1.53, 1.534, 1.525, 1.543, 1.562, 1.527, 1.524, 1.522, 1.532, 1.499, 1.456, 1.548, 1.53, 1.48, 1.46, 1.487, 1.489, 1.49, 1.477, 1.466, 1.49, 1.465, 1.482, 1.451, 1.426], \"GAMN\": [65.0846, 65.08, 53.4612, 79.0231, 41.8448, 81.345, 67.4063, 74.3767, 62.7573, 58.108, 60.4316, 69.7281, 53.4621, 81.3478, 51.1413, 83.67, 58.1094, 65.0787, 72.0522, 53.4629, 67.4029, 74.3773, 81.3497, 79.0263, 97.6171, 65.085, 85.997, 65.084, 85.9966, 65.0844, 111.559, 74.3815, 90.6449, 81.3521, 58.1119, 62.7553, 69.7283, 76.7007, 58.1091, 79.0216, 60.4348, 67.4043, 74.3767, 53.4614, 55.7825, 67.4032, 62.7564, 62.756, 53.4601, 74.3736, 46.4903, 60.4307, 60.432, 69.7279, 32.5478, 88.3145, 85.9992, 92.9707, 81.3523, 60.4364, 72.0512, 76.7016, 123.179, 60.4392, 67.4035, 106.912, 83.6772, 85.9986, 74.3793, 58.1104, 95.2903, 69.7314, 76.7007, 97.6186, 81.3544, 72.0544, 69.7292, 76.7007, 72.0535, 67.406, 69.7286, 65.0804, 69.7281, 85.9971, 95.2939, 113.888, 74.381, 90.6449, 88.3233, 83.6761, 60.4355, 104.59, 123.184, 88.327, 51.1435, 79.0217, 58.1086, 74.3749, 67.4058, 120.852, 69.7368, 69.729, 99.9392, 55.7881, 83.6686, 109.238, 76.7045, 83.6737, 69.7306, 62.7576, 76.6999, 76.702, 81.3501, 85.9985, 90.6469, 81.3524, 104.591, 88.3261, 90.6477, 95.2949, 88.3241], \"NEUT\": [1152.01, 1233.99, 1212.0, 1161.01, 1080.02, 1188.98, 1164.0, 1169.0, 1202.0, 1168.01, 1179.0, 1146.0, 1169.0, 1182.0, 1156.01, 1154.0, 1142.0, 1146.0, 1171.0, 1119.01, 1070.01, 1150.99, 1256.98, 1291.0, 1301.0, 1371.99, 1358.0, 1368.0, 1482.99, 1423.01, 1350.01, 1156.02, 1013.03, 876.016, 798.016, 629.026, 618.001, 659.992, 689.997, 765.984, 753.002, 741.001, 734.001, 767.996, 730.008, 747.997, 762.999, 793.994, 776.002, 854.983, 827.004, 886.994, 869.003, 863.001, 869.999, 884.998, 919.997, 879.008, 909.996, 931.995, 954.996, 986.997, 970.003, 953.002, 925.006, 899.004, 952.995, 967.997, 926.005, 924.0, 936.998, 968.997, 922.009, 934.999, 931.001, 945.998, 913.003, 903.002, 964.993, 937.006, 925.002, 909.001, 920.998, 924.0, 906.004, 980.989, 949.002, 908.008, 899.001, 934.992, 956.997, 969.999, 954.003, 933.002, 1023.98, 950.011, 1002.0, 1030.99, 1074.0, 1161.98, 1113.01, 1051.0, 1067.0, 1167.99, 1312.97, 1478.97, 1536.0, 1584.99, 1592.0, 1483.02, 1557.99, 1546.0, 1604.99, 1546.01, 1518.01, 1469.01, 1438.0, 1403.01, 1413.0, 1316.02, 1347.0], \"PR\": [50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9, 50499.9], \"SP\": [100.592, 100.51, 100.58, 100.555, 100.552, 100.537, 100.58, 100.543, 100.543, 100.586, 100.54, 100.51, 100.549, 100.519, 100.537, 100.54, 100.543, 100.516, 100.494, 100.528, 100.531, 100.519, 100.531, 100.513, 100.531, 100.543, 100.528, 100.482, 100.54, 100.519, 100.51, 100.543, 100.485, 100.473, 100.497, 100.476, 100.476, 100.47, 100.476, 100.491, 100.433, 100.424, 100.4, 100.381, 100.342, 100.36, 100.296, 100.314, 100.275, 100.299, 100.214, 100.214, 100.375, 100.555, 100.607, 100.61, 100.598, 100.601, 100.562, 100.562, 100.568, 100.562, 100.574, 100.549, 100.592, 100.574, 100.562, 100.662, 100.604, 100.616, 100.61, 100.632, 100.601, 100.586, 100.595, 100.598, 100.613, 100.571, 100.586, 100.607, 100.601, 100.616, 100.629, 100.629, 100.641, 100.632, 100.632, 100.613, 100.616, 100.616, 100.604, 100.629, 100.653, 100.641, 100.598, 100.632, 100.626, 100.601, 100.595, 100.616, 100.604, 100.629, 100.62, 100.607, 100.595, 100.531, 100.555, 100.531, 100.519, 100.562, 100.519, 100.543, 100.549, 100.537, 100.549, 100.565, 100.555, 100.555, 100.537, 100.558, 100.562], \"COND\": [822.68, 810.824, 801.439, 796.745, 785.137, 772.293, 757.966, 757.965, 735.738, 716.967, 715.481, 713.999, 730.545, 738.698, 757.467, 775.746, 790.321, 790.322, 806.869, 816.749, 826.383, 835.522, 848.858, 861.21, 861.211, 881.462, 885.417, 885.911, 889.616, 895.296, 900.73, 905.671, 906.659, 894.804, 883.196, 915.546, 945.188, 945.932, 922.717, 757.012, 941.705, 1071.64, 1215.13, 863.968, 699.707, 333.181, 36.2593, 26.8468, 24.3753, 89.3224, 479.289, 282.756, 398.805, 411.67, 697.637, 1003.44, 1050.16, 944.47, 819.729, 805.886, 758.219, 733.761, 685.356, 647.066, 631.504, 613.226, 589.513, 570.743, 560.366, 544.56, 528.504, 525.291, 510.721, 505.038, 504.049, 495.405, 492.193, 481.327, 478.855, 471.94, 466.259, 465.023, 453.663, 449.709, 448.968, 448.968, 444.275, 437.854, 433.901, 432.913, 423.528, 413.648, 399.571, 386.478, 381.538, 374.128, 362.766, 349.43, 345.475, 334.609, 328.927, 303.487, 270.887, 256.557, 221.489, 227.902, 199.253, 168.876, 128.614, 125.646, 108.852, 101.934, 98.2287, 85.1385, 76.247, 78.4677, 65.131, 66.1178, 68.8347, 69.3289, 65.3776]}}\n"
     ]
    }
   ],
   "source": [
    "print(t)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "dev",
   "language": "python",
   "name": "dev"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
